<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
	</body>
	<script type="text/javascript">
		var arr=[3,47,2352,31,4632,11,2,1,22];
		function bubbleSort(arr){
			for (var i = 0; i < arr.length-1; i++) {
				for (var j = 0; j < arr.length-1-i; j++) {
					if(arr[j]>arr[j+1]){
						var temp=arr[j];
						arr[j]=arr[j+1];
						arr[j+1]=temp
					}
				}
				
			}
			return arr
		}
		console.log(bubbleSort(arr))
		function selectSort(arr){
			for(var i=0;i<arr.length-1;i++){
				for(var j=i+1;j<arr.length;j++){
					if(arr[i]>arr[j]){
						swap(arr,i,j)
					}
				}
			}
			return arr
		}
		console.log(selectSort(arr))
	</script>
</html>
